package com.eshop.web.component;

import com.eshop.domain.Product;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Button;
import org.apache.wicket.markup.html.image.Image;
import org.apache.wicket.markup.html.panel.Panel;
import org.apache.wicket.model.CompoundPropertyModel;

/**
 * Created by Sergey on 13.12.13.
 */
public class ProductPanel extends Panel {
    public ProductPanel(String id, Product product) {
        super(id);
        setRenderBodyOnly(true);
        setDefaultModel(new CompoundPropertyModel<Product>(product));
    }

    @Override
    protected void onInitialize() {
        super.onInitialize();

        Label nameLabel = new Label("name");
        add(nameLabel);

//        Image pictureImage = new Image("picture", "");
//        add(pictureImage);

        Label priceLabel = new Label("price");
        add(priceLabel);

        Button addToBasketButton = new Button("addToBasket") {
            @Override
            public void onSubmit() {
                super.onSubmit();

            }
        };
        add(addToBasketButton);
    }
}
